home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- 1/89
-
- DIRK v2.0 -- Tune workbench colors to system performance
-
- Copyright (C) 1989 by Daniel Elbaum
-
- This software is freely redistributable provided that:
- the four files which comprise it (dirk, dirk.doc, dirk.h,
- adjust.c, main.c, sys, window.c) remain intact; all
- copyright notices contained in any of the aforementioned
- files remain intact; and no fee beyond reasonable remuneration
- for collation and distribution be charged for use and/or
- distribution.
-
- ***************************************************************************/
-
-
- #include "dirk.h"
-
- /*
- Find the total amount of system memory
- by cruising the master list.
- */
-
- ULONG
- totmem()
- {
- register ULONG tu, tl, tm=0;
- register struct Node *n;
- register struct MemHeader *m;
-
- Disable();
- for (n=SysBase->MemList.lh_Head; n->ln_Succ; n=n->ln_Succ){
- m=(struct MemHeader *)n;
- tu=(ULONG)m->mh_Upper;
- tl=(ULONG)m->mh_Lower;
- tm+=tu-tl;
- }
- Enable();
- return(tm);
- }
-
- /*
- Hunt up all ready tasks and waiting tasks;
- put their respective counts in r and w.
- */
-
- tqlen(r, w)
- int *r, *w;
- {
- register tr=0, tw=0;
- register struct Task *t;
-
- Disable();
- t=SysBase->TaskReady.lh_Head;
- for (tr=0; t->tc_Node.ln_Succ; t=t->tc_Node.ln_Succ)
- tr++;
- t=SysBase->TaskWait.lh_Head;
- for (tw=0; t->tc_Node.ln_Succ; t=t->tc_Node.ln_Succ)
- tw++;
- Enable();
- *r=tr;
- *w=tw;
- return(tr+tw);
- }
-
- /*
- Place amt of free chip mem into cm;
- place amt of free fast mem into fm.
- */
-
- ULONG
- amtfree()
- {
- ULONG c, f;
-
- c=AvailMem(MEMF_CHIP);
- f=AvailMem(MEMF_FAST);
- return(c+f);
- }
-